#include <stdio.h>
#include <wchar.h>
#include <locale.h>  // 设置本地化环境
#include "date_utils.h"

int main() {
    // 设置本地化环境以支持宽字符
    setlocale(LC_ALL, "en_US.UTF-8");

    // 测试 JD 和 DD
    double jd = JD(2023, 10, 15.5);
    wprintf(L"JD(2023, 10, 15.5) = %.6f\n", jd);

    Date date = DD(jd);
    wprintf(L"DD(%.6f) = %04d-%02d-%02d %02d:%02d:%02d\n", jd, date.Y, date.M, date.D, date.h, date.m, (int)date.s);

    // 测试 DD2str
    wchar_t* dateStr = DD2str(date);
    wprintf(L"DD2str: %ls\n", dateStr);

    // 测试 JD2str
    wchar_t* jdStr = JD2str(jd);
    wprintf(L"JD2str: %ls\n", jdStr);

    // 测试 timeStr
    wchar_t* time = timeStr(jd);
    wprintf(L"timeStr: %ls\n", time);

    // 测试 getWeek
    int week = getWeek(jd);
    wprintf(L"getWeek: %d\n", week);

    // 测试 nnweek
    double nnweekJD = nnweek(2023, 10, 2, 1); // 2023 年 10 月的第 2 个星期一
    wprintf(L"nnweek: %.6f\n", nnweekJD);

    return 0;
}